package zky410;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Stack;


public class assa {
    public static void main(String[] args) throws IOException {
        BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
        String s = sc.readLine();
        String s1 = reverseStr(s);
        System.out.println(s1);
    }

    public static String reverseStr(String str){
        int len = str.length();
        Stack<String> stack = new Stack<>();
        stack.push("");

        for(int i = 0;i<len;i++){
            char temp = str.charAt(i);
            if(temp == '('){
                stack.push("");
            }else if(temp == ')'){
                String pop = stack.pop();
                StringBuilder pop2 = new StringBuilder(stack.pop());
                for (int j = pop.length()-1; j >=0 ; j--) {
                    char cc=pop.charAt(j);
                    pop2.append(cc);
                }
                stack.push(pop2.toString());
            }else{
                String pop = stack.pop();
                pop += str.charAt(i);
                stack.push(pop);
            }
        }return stack.pop();
    }
}

